package com.travel.stock.web;

import com.travel.common.to.SkuHasStockVo;
import com.travel.common.utils.R;
import com.travel.stock.service.StockSkuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.*;

@Controller
public class StockSkuWebController {

    @Autowired
    StockSkuService stockSkuService;

    /**
     * 判断sku是否还有库存
     * @return
     */
    @PostMapping("/hasStock")
    @ResponseBody
    public R skuHasStock(@RequestBody SkuHasStockVo skuHasStockVo) {
        boolean b = stockSkuService.skuHasStock(skuHasStockVo.getSpuId(), skuHasStockVo.getSelectedAttrs());
        return R.ok().put("stock",b);
    }
}
